//
//  vec2f.cpp
//  
//
//  Created by Gallienne Kevin on 03/10/13.
//
//

#include "vec2f.h"
#include <iostream>

using namespace std;

vec2f::vec2f(float a, float b){
    _data[0] = a;
    _data[1] = b;
};

vec2f::vec2f(const vec2f& other){
	 _data[0] = other.getX();
	 _data[1] = other.getY();
};

const float& vec2f::getX() const{
  cout << "Vec2f: constant access request" << endl;
  return _data[0];
};

const float& vec2f::getY() const{
  cout << "Vec2f: constant access request" << endl;
  return _data[1];
};

void vec2f::setX(float a){
    _data[0] = a;
};

void vec2f::setY(float a){
    _data[1] = a;
};
float* vec2f::getData(){
    return _data;
};

float& vec2f::x(){
  cout << "Vec2f: read  access request" << endl;
  return _data[0];
};
float& vec2f::y(){
  cout << "Vec2f: read  access request" << endl;
  return _data[1];
};

vec2f vec2f::div(const float& a, bool& zeroDiv){
   vec2f res;
   if(a == 0)
     zeroDiv = false;
   res.x() = this->x()/a;
   res.y() = this->y()/a;

   return res;
};
